let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  add:function(){
    var that=this
    wx.request({
      url: app.globalData.siteroot,
       data: {
         do:'Message_getPushTmplIds',
         temp_name:'leave_message,place_order,visit_message'
      },
     success: function(res) {
        var leave_message=res.data.info.leave_message
        wx.requestSubscribeMessage({
            tmplIds: [leave_message],
            success (res) {
                wx.request({
                    url: app.globalData.siteroot,
                     data: {
                       do:'Member_subscribeTimes',
                       subscribe_data:[{"leave_message":1},{"place_order":1},{"visit_message":1}],
                       staff_id:wx.getStorageSync('staff_bind_id')
                    },
                   success: function(res) {
                       that.get_data()
                   }
                  })
            }
        })
     }
    })
  },
  onLoad: function (options) {
     this.get_data();
  },
  get_data:function(){
    var that=this
    wx.request({
      url: app.globalData.siteroot,
       data: {
         do:'Member_getSubscribeTimes',
         staff_id:wx.getStorageSync('staff_bind_id')
      },
     success: function(res) {
         that.setData({
          pushArr:res.data.data
         })
     }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})